package br.com.bonina.contabilidade.web;

import javax.annotation.PostConstruct;
import javax.enterprise.inject.Model;
import javax.faces.bean.ManagedBean;
import javax.faces.event.ActionEvent;
import javax.inject.Inject;

import br.com.bonina.contabilidade.business.planilha.PlanilhaFacade;
import br.com.bonina.contabilidade.core.BusinessException;
import br.com.bonina.contabilidade.model.Planilha;

@ManagedBean
@Model
public class PlanilhaController {

	@Inject
	private PlanilhaFacade facade;
	private Planilha model;
	
	@PostConstruct
	public void init(){
		model = new Planilha();
	}
	
	public void save(ActionEvent e){
		try {
			facade.save(model);
		} catch (BusinessException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}

	public Planilha getModel() {
		return model;
	}

	public void setModel(Planilha model) {
		this.model = model;
	}
	
	
}
